home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++
- Subject: Re: Coding Standards
- Date: 26 Mar 1996 16:23:59 GMT
- Organization: Borland International
- Message-ID: <4j95mv$74n@druid.borland.com>
- References: <4j2kgg$svj@sam.inforamp.net> <4j3vc6$nrk@news1.h1.usa.pipeline.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <4j3vc6$nrk@news1.h1.usa.pipeline.com>, grantp@usa.pipeline.co
- says...
- >
- >On Mar 24, 1996 04:53:18 in article <Re: Coding Standards>,
- >'rmorin@inforamp.net (Randy Charles Morin)' wrote:
- >
- >
- >>In article <4iuu6k$6a6@druid.borland.com>,
- >>pete@borland.com (Pete Becker) wrote:
- >>>Unfortunately, if you don't follow guidelines like this, you will miss
- >your
- >>>subsequent maintenance deadlines by many years. You'll spend all your
- >time
- >>>tracking down mysterious failures that arise when you try to enhance the
- >
- >>>program, rather than spending time on the enhancements themselves.
- >>
- >>But if you follow these guidelines, your initial release will miss your
- >>subsequent maintenance deadlines. You have to be reasonable in these
- >>situations.
- >
- >Right. I will nearly always vote on the side of reasonableness. Seems
- >to me that since writing a trivial copy constructor can be implemented
- >in a matter of seconds, it's just a good habit to write one even if its
- >need isn't obvious at the time the class is in its initial stages of
- >development. I doubt seriously if a few seconds, or even a minute or
- >two, spent at writing a copy constructor for all classes will cause
- >significant delays in product delivery.
- >
-
- Actually, it was not my intention to endorse automatically writing trivial copy
- constructors. I do trust maintenance programmers to recognize that code they've
- added requires a copy constructor, and to either change the existing one or
- write a new one as necessary. What I had in mind was rules like always having a
- virtual destructor whenever you have any other virtual functions. Violate this
- one at your peril: you may not intend to pass pointers to this function
- initially, but two days before you're due to ship your product you'll find a
- bug that requires deleting a pointer to your class, and it will not work right
- if you don't have a virtual destructor.
-
- >> Why not make the standard that if you add a data member that may
- >>cause the default copy constructor to produce erroneous results, then
- >>make one explicitly? This way you only have to write them when you need
- >>to and you have the same end result.
- >>
- >If we can rely on the maintenance programmer to think about the
- >problem, then OK, but that's not the real world. IMHO, Pete Becker is
- >absolutely correct in this matter -- well, maybe he exaggerated just
- >a little bit...
-
- You caught me: I do sometimes exaggerate just a little bit...
-
-